<!--suppress ALL -->
<include file="./Template/header.html" />

<link rel="stylesheet" type="text/css" href="/Template/css/historyRecord.css">
<script type="text/javascript">

	$(function() {

		//初始化页面配置
		initPage("历史战绩", "center");

		var app = new Vue({
			el: '#container',
			data: {
				groupList: [],
			},
			methods: {
				index: indexPage,
				order: orderPage,
				rank: rankPage,
				center: centerPage,
				result: function(id) {
					window.location.href = "/wechat/product/winDetail/id/" + id;
				}
			}
		})

		var pageNum = 1;
		var isNeedRefresh = false;

		$(window).scroll(function(){

			var scrollTop = $(this).scrollTop();
			var scrollHeight = $(document).height();
			var windowHeight = $(this).height();
			if(!isNeedRefresh &&
					(scrollHeight - scrollTop - windowHeight <= 25)){
				isNeedRefresh = true;
				refreshPage(pageNum++);
			}
		});

		function refreshPage(pageNum) {
			$.ajax({
				url:"/wechat/userCenter/historyRecordList",
				type:"post",
				data:{
					pageNum: pageNum
				},
				dataType:"JSON",
				beforeSend:function(){
					$("#loadingToast").show();
				},
				complete:function(){
					$('#loadingToast').hide();
				},
				success:function(data){
					if(data.code == 200) {
						if(!isNullOrEmpty(data.groupList)) {
							if(pageNum == 1){
								app.groupList = data.groupList;
							} else {
								app.groupList = app.groupList.concat(data.groupList);
							}
							isNeedRefresh = false;
						}
					}
				},
			})
		}

		refreshPage(pageNum);

	});


</script>
<div class="history-record">
	<div class="icon-red"></div>
	<p class="my-history-record color-99">团胜：{$winCount}次 | 团灭：{$failureCount}次 | 中奖：{$rewardCount}次</p>
	<div class="no-history-data" v-if="groupList == null">暂无记录</div>
	<div class="team-list" v-for="group in groupList">
		<div class="header-info" v-if="group.status == 3" v-on:click="result(group.winner_group_id)">
			<div class="head-img-url-zone">
				<div class="head-img-url" v-bind:class="{leader:member.is_leader == 1}" v-for="member in group.member_list" style="background:url('{{member.headimgurl}}')no-repeat center;background-size: cover;"></div>
				<div class="win-split">
					<p>全团瓜分{{group.reward}}元</p>
				</div>
			</div>
			<div class="other-info" style="clear:both;">
				<div class="other-info-padding">
					<p class="join-count"><span>{{group.nickname}}的团</span></p>
					<p class="join-num">目前团员人数 <span>{{group.member_number}}人</span></p>
					<p class="join-count">第{{group.round_index}}轮，全团持劵 <span>{{group.buy_number}}份</span></p>
				</div>
				<div class="line"></div>
				<div class="join-team-btn">
					<p>击杀其余{{group.failure_count}}团</p>
					<p>(点击查看详情)</p>
				</div>
			</div>
		</div>
		<div class="team-success-btn" v-if="group.status == 3" v-on:click="result(group.winner_group_id)"></div>

		<div class="header-info" v-if="group.status == 2"  v-on:click="result(group.winner_group_id)">
			<div class="head-img-url-zone">
				<div class="head-img-url" v-bind:class="{leader:member.is_leader == 1}" v-for="member in group.member_list" style="background:url('{{member.headimgurl}}')no-repeat center;background-size: cover;"></div>
			</div>
			<div class="other-info" style="clear:both;">
				<div class="other-info-padding">
					<p class="join-count"><span>{{group.nickname}}的团</span></p>
					<p class="join-num">目前团员人数 <span>{{group.member_number}}人</span></p>
					<p class="join-count">第{{group.round_index}}轮，全团持劵 <span>{{group.buy_number}}份</span></p>
				</div>
				<div class="line"></div>
				<div class="join-team-failed-btn">
					<p>开奖结束</p>
				</div>
			</div>
		</div>
		<div class="team-failed-btn" v-if="group.status == 2"  v-on:click="result(group.winner_group_id)"></div>

	</div>

</div>
<include file="./Template/footer.html" />